[IA64] Add ptc.l emulation
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 24 May 2006 14:48:21 +0000 (08:48 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 24 May 2006 14:48:21 +0000 (08:48 -0600)
This patch adds support for ptc.l emulation for xenlinux.
In 2.6.16 kernel it flush_tlb_range will call global_tlb_purge
directly, so ptc.l shouldn't be used when CONFIG_SMP enable.
But in order to enhance performance (maybe), 2.6.17 kernel in
smp environment will do mm check first. If mm is current->active_mm
and the mm (corresponding process) just runs on the local processor,
kernel only needs to do ptc.l at local processor instead of global purge.
So ptc.l emulation is necessary for 2.6.17 kernel.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
xen/arch/ia64/xen/privop.c
xen/arch/ia64/xen/vcpu.c
xen/include/asm-ia64/vcpu.h

index e0452fbfa5fd39c9d3fe6bf2df60022ca5161e1d..1008c7597d7c3ddb34e292c95e923bde45354d84 100644 (file)
@@ -129,10 +129,10 @@ IA64FAULT priv_cover(VCPU *vcpu, INST64 inst)
 IA64FAULT priv_ptc_l(VCPU *vcpu, INST64 inst)
 {
        UINT64 vadr = vcpu_get_gr(vcpu,inst.M45.r3);
-       UINT64 addr_range;
+       UINT64 log_range;
 
-       addr_range = 1 << ((vcpu_get_gr(vcpu,inst.M45.r2) & 0xfc) >> 2);
-       return vcpu_ptc_l(vcpu,vadr,addr_range);
+       log_range = ((vcpu_get_gr(vcpu,inst.M45.r2) & 0xfc) >> 2);
+       return vcpu_ptc_l(vcpu,vadr,log_range);
 }
 
 IA64FAULT priv_ptc_e(VCPU *vcpu, INST64 inst)
index 99a2aaaef2b609b11f4ec1ff42119a90728a7383..1c1f54ab198822817147693139d5bc7dafaecd96 100644 (file)
@@ -1848,12 +1848,17 @@ IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
        return IA64_NO_FAULT;
 }
 
-IA64FAULT vcpu_ptc_l(VCPU *vcpu, UINT64 vadr, UINT64 addr_range)
+IA64FAULT vcpu_ptc_l(VCPU *vcpu, UINT64 vadr, UINT64 log_range)
 {
-       printk("vcpu_ptc_l: called, not implemented yet\n");
-       return IA64_ILLOP_FAULT;
-}
+       /* Purge TC  */
+       vcpu_purge_tr_entry(&PSCBX(vcpu,dtlb));
+       vcpu_purge_tr_entry(&PSCBX(vcpu,itlb));
+       
+       /*Purge all tlb and vhpt*/
+       vcpu_flush_tlb_vhpt_range (vadr, log_range);
 
+       return IA64_NO_FAULT;
+}
 // At privlvl=0, fc performs no access rights or protection key checks, while
 // at privlvl!=0, fc performs access rights checks as if it were a 1-byte
 // read but no protection key check.  Thus in order to avoid an unexpected
index 4e6ce071c0f558a1bd02dfeeb073d49cfd0e6683..6e1fa007ad3cb2dabb3b36af55ae03b13a90b8e7 100644 (file)
@@ -145,7 +145,7 @@ extern IA64FAULT vcpu_itr_i(VCPU *vcpu, UINT64 slot, UINT64 padr,
                UINT64 itir, UINT64 ifa);
 extern IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 padr, UINT64 itir, UINT64 ifa);
 extern IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 padr, UINT64 itir, UINT64 ifa);
-extern IA64FAULT vcpu_ptc_l(VCPU *vcpu, UINT64 vadr, UINT64 addr_range);
+extern IA64FAULT vcpu_ptc_l(VCPU *vcpu, UINT64 vadr, UINT64 log_range);
 extern IA64FAULT vcpu_ptc_e(VCPU *vcpu, UINT64 vadr);
 extern IA64FAULT vcpu_ptc_g(VCPU *vcpu, UINT64 vadr, UINT64 addr_range);
 extern IA64FAULT vcpu_ptc_ga(VCPU *vcpu, UINT64 vadr, UINT64 addr_range);